﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Donal.Xms.Web.temp.main
{
    public partial class main : Web.UI.MasterBasePage
    {
        protected string appId = "";
        protected string nonceStr = "";
        protected string timestamp = "";
        protected string signature = "";
        protected string wxTitle = "";
        protected string wxDesc = "";
        protected string wxLinkUrl = "";
        protected string wxImgLinkUrl = "";
        protected string wxTempImgLinkUrl = "";
        protected bool scan = false;

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        #region 绑定微信分享图片
        public void bindWechartImg(string img_url = "")
        {
            if (!basePage.isMobile())
            {
                return;
            }

            if (img_url != "")
            {
                wxImgLinkUrl = Request.Url.Scheme + "://" + Request.Url.Authority.ToLower() + img_url;
            }
            else
            {
                wxImgLinkUrl = Request.Url.Scheme + "://" + Request.Url.Authority.ToLower() + "/temp/main/images/wxlogo.png";
            }
        }
        #endregion

        #region 绑定Form
        public void bindForm(string url)
        {
            form1.Target = "_blank";
            form1.Method = "post";
            form1.Action = url;
            form1.Attributes.Add("url", url);
        }
        #endregion

        #region 绑定SEO

        public void bindSEO(string _seo_title = "", string _seo_keywords = "", string _seo_description = "", string _page_title = "")
        {
            this.Page.Title = _seo_title != "" ? _seo_title : _page_title != "" ? _page_title : basePage.site.seo_title != "" ? basePage.site.seo_title : basePage.site.name != "" ? basePage.site.name : basePage.site.title;
            this.keywords.Content = _seo_keywords != "" ? _seo_keywords : basePage.site.seo_keyword;
            this.description.Content = _seo_description != "" ? _seo_description : basePage.site.seo_description;

            wxTitle = this.Page.Title;
            wxDesc = keywords.Content + " " + description.Content;
        }


        #endregion
    }
}